Skip to content

Conversation

@Shehrozkashif
Copy link
Collaborator

@Shehrozkashif Shehrozkashif commented Mar 28, 2025

This PR adds the Zclsd extension to the database. Zclsd introduces compressed load/store pair instructions for RV32 by reusing RV64-only instruction encodings, which helps improve code density and performance when leveraging a wider than XLEN memory interface. It defines 16-bit instruction encodings and utilizes the same even-odd register pairing as the Zdinx extension. Additionally, Zclsd depends on the Zilsd and Zca extensions, and it is incompatible with Zcf due to overlapping encodings
Closes #572

@Shehrozkashif Shehrozkashif force-pushed the Zclsd_extension branch 2 times, most recently from 02d3cc1 to fb4e75d Compare April 7, 2025 19:40
@Shehrozkashif Shehrozkashif requested a review from AFOliveira April 7, 2025 20:32
Copy link
Collaborator

@dhower-qc dhower-qc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments apply to all the instructions.

@ThinkOpenly
Copy link
Collaborator

@Shehrozkashif, did you see that there are "conflicts that must be resolved"?

@Shehrozkashif
Copy link
Collaborator Author

@ThinkOpenly yes I can see the conflict Should I keep the new logic, the main branch version, or try to merge both?

@AFOliveira
Copy link
Collaborator

@ThinkOpenly yes I can see the conflict Should I keep the new logic, the main branch version, or try to merge both?

I know your comment is intended to Paul, but I would say to try to manually merge and see what has been done.

If it is the work you have been doing, probably just review the upstream changes, and if you agree, keep them, if you dont agree just push changes to them

@Shehrozkashif
Copy link
Collaborator Author

Thanks for the advice, @AFOliveira! I'll go ahead and manually merge the changes and review the differences. If the upstream changes align with my work, I’ll keep them; if not, I’ll make the necessary adjustments. Appreciate the help!

@AFOliveira
Copy link
Collaborator

Thanks for the advice, @AFOliveira! I'll go ahead and manually merge the changes and review the differences. If the upstream changes align with my work, I’ll keep them; if not, I’ll make the necessary adjustments. Appreciate the help!

If in doubt, use git blame to understand who did the changes and try reaching out to them, or even ask for the review after you merge

Shehrozkashif and others added 2 commits June 5, 2025 00:51
Co-authored-by: Paul Clarke <[email protected]>
Signed-off-by: Shehroz Kashif <[email protected]>
@ThinkOpenly
Copy link
Collaborator

If you update the instruction appendix once more, I think this'll be ready to be merged!

@Shehrozkashif
Copy link
Collaborator Author

Iam stucked with this error

       from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `bind_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `validate_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
        from /workspaces/riscv-unified-db/Rakefile:275:in `block (2 levels) in <top (required)>'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `block in execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `each'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `synchronize'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:188:in `invoke'
        from /workspaces/riscv-unified-db/Rakefile:464:in `block (2 levels) in <top (required)>'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `block in execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `each'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `synchronize'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:188:in `invoke'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:188:in `invoke_task'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block (2 levels) in top_level'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `each'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block in top_level'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:147:in `run_with_threads'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:132:in `top_level'
        from -e:1:in `<main>'
root@cd42357dc24c:/workspaces/riscv-unified-db# 

@dhower-qc
Copy link
Collaborator

dhower-qc commented Jun 10, 2025

I think the relevant message got cut off; it's going to be above the backtrace

@ThinkOpenly
Copy link
Collaborator

CI is failing due to:

/home/runner/work/riscv-unified-db/riscv-unified-db/lib/arch_obj_models/instruction.rb:1065:in `encoding': c.ldsp is not defined in 32 (RuntimeError)

This may be explained by the base: 64 in that definition (and c.sdsp). Removing both base: 64 lines might do the trick.

@Shehrozkashif
Copy link
Collaborator Author

I think this one is the main one

/workspaces/riscv-unified-db/lib/arch_obj_models/database_obj.rb:233:in `source_line': No $source for misa (RuntimeError)

@Shehrozkashif
Copy link
Collaborator Author

here the complete one

[INFO] 2025-06-13 18:13:49: Running test:schema
Checking arch files against schema..
/workspaces/riscv-unified-db/lib/arch_obj_models/database_obj.rb:233:in `source_line': No $source for misa (RuntimeError)
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `bind_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `validate_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
        from /workspaces/riscv-unified-db/lib/arch_obj_models/csr_field.rb:106:in `type_ast'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `bind_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `validate_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
        from /workspaces/riscv-unified-db/lib/arch_obj_models/csr_field.rb:126:in `type_checked_type_ast'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `bind_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `validate_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
        from /workspaces/riscv-unified-db/lib/arch_obj_models/csr_field.rb:205:in `type'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:179:in `bind_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:179:in `validate_call_skip_block_type'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:121:in `block in create_validator_slow_skip_block_type'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:6383:in `block in calc_value'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:6382:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:6382:in `calc_value'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:6305:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:154:in `block in value_try'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:153:in `catch'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:153:in `value_try'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:157:in `value_try'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:6304:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:5456:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:5456:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:5456:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `block in freeze_tree'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `each'
        from /workspaces/riscv-unified-db/lib/idl/ast.rb:369:in `freeze_tree'
        from /workspaces/riscv-unified-db/lib/cfg_arch.rb:205:in `initialize'
        from /workspaces/riscv-unified-db/Rakefile:102:in `new'
        from /workspaces/riscv-unified-db/Rakefile:102:in `cfg_arch_for'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `bind_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/call_validation.rb:282:in `validate_call'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.11966/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
        from /workspaces/riscv-unified-db/Rakefile:275:in `block (2 levels) in <top (required)>'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `block in execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `each'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `synchronize'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:188:in `invoke'
        from /workspaces/riscv-unified-db/Rakefile:464:in `block (2 levels) in <top (required)>'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `block in execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `each'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `execute'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `synchronize'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/task.rb:188:in `invoke'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:188:in `invoke_task'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block (2 levels) in top_level'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `each'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block in top_level'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:147:in `run_with_threads'
        from /workspaces/riscv-unified-db/.home/.gems/ruby/3.2.0/gems/rake-13.2.1/lib/rake/application.rb:132:in `top_level'
        from -e:1:in `<main>'
root@cd42357dc24c:/workspaces/riscv-unified-db# 

Copy link
Collaborator

@AFOliveira AFOliveira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shehrozkashif Seems like the only thing preventing you from merging is actually updating the golden.adoc? Are you aware how to update this file? Just copy/paste your new instructions.adoc. If you need any help, just reach out!

@Shehrozkashif
Copy link
Collaborator Author

@AFOliveira Im getting the same error while running

./do gen:instruction_appendix

@AFOliveira
Copy link
Collaborator

@AFOliveira Im getting the same error while running

./do gen:instruction_appendix

Thats not the error that appears in CI

@ThinkOpenly
Copy link
Collaborator

/workspaces/riscv-unified-db/lib/arch_obj_models/database_obj.rb:233:in `source_line': No $source for misa (RuntimeError)

I hit a similar problem today, fixed via:

$ ./do clean

And then run whatever you ran before. The "clean" task can be very handy, especially for unexpected failures.

@AFOliveira
Copy link
Collaborator

needs @dhower-qc approval to merge

Copy link
Collaborator

@dhower-qc dhower-qc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sticking with this one!!

@dhower-qc dhower-qc enabled auto-merge June 18, 2025 14:56
@dhower-qc dhower-qc added this pull request to the merge queue Jun 18, 2025
Merged via the queue into riscv-software-src:main with commit 825cc5e Jun 18, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Zclsd Extension Data

6 participants